package com.br.android.widing.db;

import android.database.Cursor;
import android.database.sqlite.SQLiteCursor;
import android.database.sqlite.SQLiteCursorDriver;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteQuery;

public class WidingCategoriaCursor extends SQLiteCursor {

	public static final String QUERY_CATEGORIA = "SELECT * FROM categoria";
	public static final String QUERY_CATEGORIA_BY_NOME ="SELECT * FROM categoria WHERE nomecategoria = ?";

	public WidingCategoriaCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
			String editTable, SQLiteQuery query) {
		super(db, driver, editTable, query);
	}

	public static class Factory implements CursorFactory {

		@Override
		public Cursor newCursor(SQLiteDatabase db,
				SQLiteCursorDriver masterQuery, String editTable,
				SQLiteQuery query) {
			return new WidingCategoriaCursor(db, masterQuery, editTable, query);
		}
	}

	public int getIdCategoria() {
		return getInt(getColumnIndex("idcategoria"));
	}

	public String getNomeCategoria() {
		return getString(getColumnIndex("nomecategoria"));
	}

}
